package com.gotool.time;

import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.Objects;

/**
 * @author guozheng
 * @date 2024/3/27
 */
public class Times {
    private Times() {
        throw new AssertionError("no instance for you");
    }


    /**
     * 获取当前时间
     * @return
     */
    public static LocalDateTime now() {
        return LocalDateTime.now();
    }

    /**
     * 获取当前日期的开始时间
     * @param date 日期
     * @return
     */
    public static LocalDateTime atStartOfDay(LocalDate date) {
        Objects.requireNonNull(date);
        return date.atStartOfDay();
    }

    /**
     * 获取当前日期的结束时间
     *
     * @param date
     * @return
     */
    public static LocalDateTime atEndOfDay(LocalDate date) {
        Objects.requireNonNull(date);
        return date.atTime(LocalTime.MAX);
    }


    public static int getDayOfMonth(LocalDate day) {
        return day.getDayOfMonth();
    }








}
